Package

library(tidyverse)
library(plotly)

About plotly

To ensure plotly is installed correctly.

plot_ly(z=~volcano)

Working with plotly

  1. First create a plot with ggplot.
p <- ggplot(txhousing, aes(date, median)) +
  geom_line(aes(group = city), alpha = 0.2)
p

  1. The ggplotly() function: converts a ggplot object to a plotly object.

Arranging multiple htmlwidgets with flexbox

library(shiny)
fluidPage(
  fluidPage(
    fluidRow(p),
    fluidRow(
      column(6, p), column(6, p)
    )
  )
)